package com.company._0引入;

import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Properties;

public class Main {

    public static void main(String[] args) throws IOException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {

        // 1. 读取配置
        Properties p = new Properties();
        p.load(new FileInputStream("round100.txt"));
        String name = "com.company._0引入."+p.getProperty("name");
        System.out.println(name);

        // 2. 根据配置创建关卡信息
        Monster m=null;
//        if("SmallMonster".equals(name))
//        {
//            m = new SmallMonster();
//        }
//        else if("SupperMonster".equals(name))
//        {
//            m = new SuperMonster();
//        }
//        else if("BossMonster".equals(name))
//        {
//            m = new BossMonster();
//        }

        // 得到怪物类的类对象
        Class c = Class.forName(name);
        m = (Monster)c.getDeclaredConstructor().newInstance();


        // 假设有很多怪物

        m.kill();
    }
}
